import { Box, Avatar } from "@mui/material";
import { useWatch, Control } from "react-hook-form";

interface Props {
  control: Control;
  name: string;
  sx?: any;
}
const DynamicAvatar = ({ control, name, sx = {} }: Props) => {
  const img = useWatch({ control, name, defaultValue: "" });
  return <Avatar src={img} sx={{ height: 200, width: 200, ...sx }} />;
};

export default DynamicAvatar;
